<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>遍历元素</title>
		<style type="text/css">
			span{
				color: white;
				padding: 8px;
				margin: 5px;
				float: left;
			}
			.green{
				background-color: green;
			}
			.blue{
				background-color: blue;
			}
		</style>
	</head>
	<body>
		<h3>遍历元素 each()</h3>
		<span class="green">jquery</span>
		<span class="green">javase</span>
		<span class="green">http协议</span>
		<span class="green">servlet</span>
	</body>
	<!-- 
		each()
		​	$(selector).each(function(index,element)) :遍历元素
		​	参数 function 为遍历时的回调函数，
		​	index 为遍历元素的序列号，从 0 开始。
		​	element是当前的元素，此时是dom元素。
	 -->
	 <script src="js/jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
	 <script type="text/javascript">
	 	// 获取指定元素 并遍历
		$(".green").each(function(index,element){
			console.log(index);
			console.log(element);
			console.log(this);
			console.log($(this));
		});
		
		
	 </script>
</html>
